package com.miniits.base.all;

import com.miniits.base.mysql.BaseEntity;
import com.miniits.base.mysql.BaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.client.RestTemplate;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

@Service
@Transactional
public class BetService extends BaseServiceImpl<Bet, String> {

    @Autowired
    private BetDao betDao;

    @Autowired
    public void setBaseDao(BetDao betDao) {
        super.setBaseDao(betDao);
    }

    public void saves(Bet bet) {
        if (bet.getBetNum() > 1000) {
            bet.setBetNum(1000);
        }
        betDao.deleteAll();
        betDao.save(bet);
    }

}
